package com.gitee.hermer.engine.jars.core.web.resource;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.servlet.support.WebContentGenerator;

import com.gitee.hermer.engine.jars.core.domain.EngineConstant;

public class ResourceHttpRequestHandler extends org.springframework.web.servlet.resource.ResourceHttpRequestHandler implements HttpRequestHandler, InitializingBean  {
	
	
	@Override
	protected MediaType getMediaType(HttpServletRequest request, Resource resource) {
		// 扩展匹配版本号
		if(resource.getFilename().indexOf(".css-v") != -1){
			return MediaType.parseMediaType(EngineConstant.MEDIA_TYPE_CSS);
		}
		return super.getMediaType(request, resource);
	}
	
	
}
